import './App.css';
import {useRef, useState} from "react";

function Son(props) {
    console.log(props)
    return (
        <div>
            <button onClick={()=>props.sonCallBack("快快快")}>发送：子传父</button>
        </div>
    )
}

function App() {
    function sonCallBack(msg) {
        console.log(msg)
    }

    /**
     * 在子组件中调用父组件中的函数并传递参数
     */
    return (
        <div>
            <Son sonCallBack={sonCallBack}></Son>
        </div>
    )
}

export default App;